package com.csj.mvvmtest.ui.second

import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import com.csj.mvvm.ui.base.BaseAdapter
import com.csj.mvvm.utils.SysUtils
import com.csj.mvvmtest.R
import com.csj.mvvmtest.bean.NaviBean
import com.csj.mvvmtest.databinding.ItemSecondLeftBinding


class SecondLeftAdapter(context: FragmentActivity, listDatas: ArrayList<NaviBean>) :
    BaseAdapter<ItemSecondLeftBinding, NaviBean>(context, listDatas) {

    var selPos = 0

    override fun convert(v: ItemSecondLeftBinding, t: NaviBean, position: Int) {
        v.tvLeft.text = t.name
        if (position == selPos) v.tvLeft.setTextColor(
            ContextCompat.getColor(
                mContext,
                R.color.blue_txt
            )
        )
        else v.tvLeft.setTextColor(ContextCompat.getColor(mContext, R.color.color_333333))

        val lp = v.tvLeft.layoutParams
        lp.height = SysUtils.dp2Px(mContext, 44F)
        v.tvLeft.layoutParams = lp
    }

}
